var util = {
    addHandler: function(ele,type,handler){
        if(ele.addEventListener){
            ele.addEventListener(type,handler,false);
        }else if(ele.attachEvent){
            ele.attachEvent("on"+type,handler);
        }else{
            ele["on"+type] = handler;
        }
    }
};
var FloatLayer = function(obj) {
    this.ele = obj;
    this.visible = false;
    this.floatLayer = this.ele.parentNode;
}
FloatLayer.prototype = {
    show: function() {
        this.visible = true;
        this.ele.style.transform = "translate(-50%,-50%) scale(1,1)";
        this.floatLayer.style.display = "block";
    },
    hide: function() {
        this.visible = false;
        this.ele.style.transform = "translate(-50%,-50%) scale(0,0)";
        self = this;
        self.floatLayer.style.display = "none";
    },
    setFloatLayerHandler: function(obj){
        util.addHandler(obj.floatLayer,"click",function(){
            obj.hide();
        });
        util.addHandler(obj.ele,"click",function(event){
            event.stopPropagation();
        });
    }
}